package cn.edu.scau.cmi.chenyuanying.singleton;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.text.Text;

public class SingletonController implements Initializable {
	@FXML private TextField inputSingleName;
	@FXML private Button createSingleButton;	
	@FXML private Text frontChairmanLabel;
	@FXML private Text backChairmanLabel;
	private String preLabel = "";
	
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
	}

	public void createSingleChairman(ActionEvent event) {
		String name = inputSingleName.getText();
		frontChairmanLabel.setText(preLabel);
		backChairmanLabel.setText(Chairman.getInstance(name).toString());
		preLabel = backChairmanLabel.getText();
	}
	
	public void clearInputName(MouseEvent e) {
		inputSingleName.setText("");
	}

}
